import pytest
import allure
import requests
import random

# base_url="http://120.55.83.187:8899"

# class Test_crmeb:
#
#     @allure.story("查询用户分组")
#     def test_grouping1(self,login):
#         a=requests.get(url=base_url+"/adminapi/user/user_group/list?page=1&limit=15",headers={'Authori-zation':'Bearer '+str(login)})
#
#     @allure.story("添加用户分组")
#     def test_grouping2(self,login):
#         a=requests.post(url=base_url+"/adminapi/user/user_group/save.html",json={"group_name":random.randint(10,100)},headers={'Authori-zation':'Bearer '+str(login)})
#
#     @allure.story("修改用户分组")
#     def test_grouping3(self,login,check_group):
#         a=requests.post(url=base_url+"/adminapi/user/user_group/save.html",json={"id":check_group,"group_name":random.randint(111,999)},headers={'Authori-zation':'Bearer '+str(login)})
#
#     @allure.story("删除用户分组")
#     def test_grouping4(self,login,check_group):
#         a=requests.delete(url=base_url+f"/adminapi/user/user_group/del/{check_group}",headers={'Authori-zation':'Bearer '+str(login)})
#
#     @allure.story("添加客服话术")
#     def test_speech1(self,login):
#         a=requests.post(url=base_url+"/adminapi/app/wechat/speechcraft",json={"cate_id":0,"title":random.randint(1,99),"message":random.randint(1,99),"sort":0},headers={'Authori-zation':'Bearer '+str(login)})\
#
#     @allure.story("修改客服话术")
#     def test_speech2(self,login,check_speech):
#         a=requests.put(url=base_url+f"/adminapi/app/wechat/speechcraft/{check_speech}",json={"cate_id":0,"title":random.randint(11111,99999),"message":random.randint(11111,99999),"sort":0},headers={'Authori-zation':'Bearer '+str(login)})
#     @allure.story("删除客服话术")
#     def test_speech3(self,login,check_speech):
#         a=requests.delete(url=base_url+f"/adminapi/app/wechat/speechcraft/{check_speech}",headers={'Authori-zation':'Bearer '+str(login)})
#
#
#     @allure.story("添加用户标签")
#     def test_label1(self,login):
#         a=requests.post(url=base_url+"/adminapi/user/user_label/save.html",json={"label_cate":random.randint(1,6),"label_name":random.randint(1,9)},headers={'Authori-zation':'Bearer '+str(login)})
#     @allure.story("删除用户标签")
#     def test_label2(self,login,check_label):
#         a=requests.delete(url=base_url+f"/adminapi/user/user_label/del/{check_label}",headers={'Authori-zation':'Bearer '+str(login)})
#
#
#

base_url2="http://jxc.b2zg.cn"
class Test_ber:

    @allure.story("新增一个商品分类")
    def test_classification1(self,login2,check_classification1):
        a = requests.post(url=base_url2+"/api/goodCat/saveData",json={"id":"null","pid":check_classification1,"name":random.randint(11111,99999)},headers={'authorization': 'Bearer ' + str(login2)})
    @allure.story("删除之前新增的商品分类")
    def test_classification2(self,login2,check_classification2):
        a = requests.post(url=base_url2+"/api/goodCat/delete",json=check_classification2,headers={'authorization': 'Bearer ' + str(login2)})








